var $container = $('#container');
// initialize


$(function () {

    $("#worksAddSubmit").live("click",function(){
    	var image = $("#image").val();
    	var worksName = $("#worksName").val().trim();
    	var worksWidth = $("#worksWidth").val().trim();
    	var worksHeigh = $("#worksHeigh").val().trim();
    	if(image ==""){
    		alert("请先上传图片！");
    		return;
    	}
    	if(worksName ==""){
    		alert("请填写名称！");
    		return;
    	}
    	if(worksWidth =="" || worksHeigh ==""){
    		alert("请填写图片尺寸！");
    		return;
    	}
    	$("#worksAddForm").submit();
    });
    
    $("#worksEditSubmit").live("click",function(){
    	var uploadFlag = $("#uploadFlag").val();
    	var image = $("#image").val();
    	var worksName = $("#worksName").val().trim();
    	var worksWidth = $("#worksWidth").val().trim();
    	var worksHeigh = $("#worksHeigh").val().trim();
    	if(uploadFlag=="1" && image ==""){
    		alert("请先上传图片！");
    		return;
    	}
    	if(worksName ==""){
    		alert("请填写名称！");
    		return;
    	}
    	if(worksWidth =="" || worksHeigh ==""){
    		alert("请填写图片尺寸！");
    		return;
    	}
    	$("#worksEditForm").submit();
    });
});
